/**
 * @file       MenuButton_test.cpp
 * @brief      TODO
 * @author     Huabo Zheng
 * @date       Feb 3, 2012
 * @Copyright  2012, www.netgear.com Inc. All rights reserved.
 */

#include "MenuButton.h"
#include "gtest/gtest.h"
#include "errorcode.h"
#include "Panel.h"
#include "typedefine.h"
namespace NS_LCD_AFW
{
class CMenuButton_test: public ::testing::Test

{
public:
	virtual void SetUp()
	{
		OBJ_NEW(CPanel,m_pPanel);
		m_pPanel->create("test",CRect(0,0,10,10));
	}
	virtual void TearDown()
	{
		OBJ_DESTORY(m_pPanel);
	}
	CPanel *m_pPanel;
};
TEST_F(CMenuButton_test,test_defualtConstruction)
{
}
TEST_F(CMenuButton_test,test_onSetFocus)
{
	CMenuButton *pBtn = new CMenuButton();
	EXPECT_FALSE(pBtn->isHightlight());
	EXPECT_FALSE(pBtn->hasFocus());
	EXPECT_EQ(ERR_SUCCESS,pBtn->setFocus(true));
	EXPECT_TRUE(pBtn->hasFocus());
	EXPECT_FALSE(pBtn->isHightlight());
	EXPECT_EQ(ERR_SUCCESS,pBtn->setFocus(false));
	EXPECT_FALSE(pBtn->isHightlight());
	EXPECT_FALSE(pBtn->hasFocus());
	EXPECT_EQ(ERR_SUCCESS,pBtn->setHightlight(true));
	EXPECT_TRUE(pBtn->hasFocus());
	EXPECT_TRUE(pBtn->isHightlight());
	EXPECT_EQ(ERR_SUCCESS,pBtn->setHightlight(false));
	EXPECT_FALSE(pBtn->hasFocus());
	EXPECT_FALSE(pBtn->isHightlight());
	OBJ_DESTORY(pBtn);
}
TEST_F(CMenuButton_test,test_onLostFocus)
{
	CMenuButton *pBtn = new CMenuButton();
	EXPECT_FALSE(pBtn->isHightlight());
	EXPECT_FALSE(pBtn->hasFocus());
	EXPECT_EQ(ERR_SUCCESS,pBtn->setFocus(true));
	EXPECT_TRUE(pBtn->hasFocus());
	EXPECT_FALSE(pBtn->isHightlight());
	EXPECT_EQ(ERR_SUCCESS,pBtn->setFocus(false));
	EXPECT_FALSE(pBtn->isHightlight());
	EXPECT_FALSE(pBtn->hasFocus());
	EXPECT_EQ(ERR_SUCCESS,pBtn->setHightlight(true));
	EXPECT_TRUE(pBtn->hasFocus());
	EXPECT_TRUE(pBtn->isHightlight());
	EXPECT_EQ(ERR_SUCCESS,pBtn->setHightlight(false));
	EXPECT_FALSE(pBtn->hasFocus());
	EXPECT_FALSE(pBtn->isHightlight());
	OBJ_DESTORY(pBtn);
}
} /* namespace NS_LCD_AFW */
